package fun.werfamily.wf.order.core.domain.enums;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: Mr.WenMing Zhang
 * @Date: 2023-04-29 17:27
 * @Description:
 */
public enum OrderStatusEnum {
    WAIT_PAY(0, "待支付"),
    WAIT_DELIVERY(1, "待发货"),
    WAIT_CONFIRM(2, "待收货"),
    CONFIRMED(3, "待评价"),
    CANCELED(4, "已取消"),
    DELETED(5, "已删除")
    ;

    private Integer orderStatus;

    private String desc;

    OrderStatusEnum(Integer orderStatus, String desc) {
        this.orderStatus = orderStatus;
        this.desc = desc;
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public static OrderStatusEnum getByOrderStatus(Integer orderStatus){
        for (OrderStatusEnum value : OrderStatusEnum.values()) {
            if (value.orderStatus.equals(orderStatus)) {
                return value;
            }
        }
        return WAIT_PAY;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
